import request from '@/utils/request'

var pickerOptions2 = {
	      	shortcuts: [{
	        text: '最近一周',
	        onClick(picker) {
	          const end = new Date();
	          const start = new Date();
	          start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
	          picker.$emit('pick', [start, end]);
	        }
	      }, {
	        text: '最近一个月',
	        onClick(picker) {
	          const end = new Date();
	          const start = new Date();
	          start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
	          picker.$emit('pick', [start, end]);
	        }
	      }, {
	        text: '最近三个月',
	        onClick(picker) {
	          const end = new Date();
	          const start = new Date();
	          start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
	          picker.$emit('pick', [start, end]);
	        }
	      }]
	    }
	    
export function formatter(id,selectData) {			//格式化下拉列表
	let word = '';
	if(id == null){
		word = '';
	}else{
		selectData.forEach(item =>{
			if(item.value == id.toString()){			
				word = item.label;
			}
		})
	}
	return word;
}

export function safeRestPassword(password,newPassword) {		//重置密码
  	return request({
    	url: '/safe/restPassword',
    	headers:{'Content-Type':'application/json;charset=UTF-8'},
   		method: 'get',
    	params:{
    		newPassword,
    		password
    	},
  	})
}

export function safeChangeArea(area) {		//切换区域
  	return request({
    	url: '/safe/changeArea',
    	headers:{'Content-Type':'application/json;charset=UTF-8'},
   		method: 'get',
    	params:{
    		area
    	},
  	})
}

/*
 商家管理
 * */
export function busStatistics(postData) {		//商家数据统计
  	return request({
    	url: '/bus/statistics',
    	headers:{'Content-Type':'application/json;charset=UTF-8'},
   		method: 'post',
    	data:JSON.stringify(postData),
  	})
}

export function busPage(postData) {		//商家列表
  	return request({
    	url: '/bus/page',
    	headers:{'Content-Type':'application/json;charset=UTF-8'},
   		method: 'post',
    	data:JSON.stringify(postData),
  	})
}

/*
 会员管理
 * */
export function memberPage(postData) {		//会员列表
  	return request({
    	url: '/member/page',
    	headers:{'Content-Type':'application/json;charset=UTF-8'},
   		method: 'post',
    	data:JSON.stringify(postData),
  	})
}

export function memberStatistics(postData) {		//会员统计
  	return request({
    	url: '/member/statistics',
    	headers:{'Content-Type':'application/json;charset=UTF-8'},
   		method: 'post',
    	data:JSON.stringify(postData),
  	})
}

/*
 财务管理
 * */
export function financeInfo(postData) {		//获取代理账户信息
  	return request({
    	url: '/finance/info',
    	headers:{'Content-Type':'application/json;charset=UTF-8'},
   		method: 'post',
    	data:JSON.stringify(postData),
  	})
}

export function financeBrokerage(postData) {		//获取代理账户统计信息
  	return request({
    	url: '/finance/brokerage',
    	headers:{'Content-Type':'application/json;charset=UTF-8'},
   		method: 'post',
    	data:JSON.stringify(postData),
  	})
}

export function financePage(postData) {		//获取代理提现记录
  	return request({
    	url: '/finance/page',
    	headers:{'Content-Type':'application/json;charset=UTF-8'},
   		method: 'post',
    	data:JSON.stringify(postData),
  	})
}

export function financeWithdraw(postData) {		//提现
  	return request({
    	url: '/finance/withdraw',
    	headers:{'Content-Type':'application/json;charset=UTF-8'},
   		method: 'post',
    	data:JSON.stringify(postData),
  	})
}

export function financeIncomePage(postData) {		//提现
  	return request({
    	url: '/finance/incomePage',
    	headers:{'Content-Type':'application/json;charset=UTF-8'},
   		method: 'post',
    	data:JSON.stringify(postData),
  	})
}

export {pickerOptions2}
export default{
	
}

